package com.panku.controller;

import com.panku.common.vo.Result;
import com.panku.entity.Product;
import com.panku.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: jack
 * @Description:
 * @Date Create in 8:30 2021-02-02
 **/
@RequestMapping("/product")
@RestController
public class ProductController {

    @Autowired
    private IProductService productService;


    @PostMapping("/get/{pid}")
    public Product getById(@PathVariable("pid") Integer pid) {
        return productService.get(pid);
    }

    @PostMapping("/add")
    public void save(@RequestBody Product product) {
        productService.save(product);
    }


}
